//
//  Person.swift
//  TestSwift
//
//  Created by 小星星吃KFC on 2021/6/8.
//

import Foundation
struct Person {
    
    enum Gender:Int {
        case Male
        case Female
        case Other
    }
    var firstName = ""
    var lastName = ""
    var fullName: String {
        firstName + lastName
    }
    var gender: Gender = .Other
    var age: Int = 0
    var interest: String = ""
    init(firstName: String,
         lastName: String,
         gender: Gender,
         age: Int,
         interest: String) {
        self.firstName = firstName
        self.lastName = lastName
        self.gender = gender
        self.age = age
        self.interest = interest
    }
    
}


extension Person: CustomStringConvertible {
    var description: String {
        
        return """
            {
                "firstName":"\(firstName)",
                "lastName":"\(lastName)",
                "fullName":"\(fullName)",
                "gender":"\(gender.rawValue)",
                "age":\(age),
                "interest":"\(interest)"
            }
            """
    }
}
